/*
 * hoursPopup
 * 
 * Copyright 2011 Matt Whipple <matt@mattwhipple.com>
 * 
 * This file is part of com.teamsuperfitness.www
 * 
 * com.teamsuperfitness.apps is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or (at your option)
 * any later version.
 * 
 * com.teamsuperfitness.apps is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with com.teamsuperfitness.apps. If not, see http://www.gnu.org/licenses/.
 */

$(function() {
	$("#navHours").toggle(
	    function() {
		showHours();
		return false;
	    },
	    function() {
		hideHours();
		return false;
	    });
})


var hoursDiv = {
	get : function() {
		if (!this.div) {
			this.div = $('<div id="topHours"></div>')
			.load('/snippets/hours.html')
			.appendTo("#wrapper")
		}
		return this.div;
	}
}

function showHours() {
	$("#navHours").addClass("on");
	$("#headLocations").animate({
		"right": 325
	}, 600, function() {
	hoursDiv.get().css({
		"position": "absolute",
		"top": 40,
		"right": 20,
		"display": "none"
	})
	.fadeIn(1500);
	});
}

function hideHours() {
	$("#navHours").removeClass("on");
	$('#topHours').fadeOut(300, function() {
	$("#headLocations").animate({
		"right": 45
	}, 1000);
	
	});
}